<template>
	<view>
		<u-tabbar :value="value" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" activeColor="#0138D2"
			inactiveColor="#333A54">
			<u-tabbar-item text="首页" name="index/index" @click="changeItem">
				<image class="tabbarImg" slot="active-icon" src="@/static/tabBar/tabBar1_on.png"></image>
				<image class="tabbarImg" slot="inactive-icon" src="@/static/tabBar/tabBar1_on.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="政策" name="policy/policy" @click="changeItem">
				<image class="tabbarImg" slot="active-icon" src="@/static/tabBar/tabBar2.png"></image>
				<image class="tabbarImg" slot="inactive-icon" src="@/static/tabBar/tabBar2.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="活动" name="activity/activity" @click="changeItem">
				<image class="tabbarImg" slot="active-icon" src="@/static/tabBar/tabBar3.png"></image>
				<image class="tabbarImg" slot="inactive-icon" src="@/static/tabBar/tabBar3.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="积分" name="integral/integral" @click="changeItem">
				<image class="tabbarImg" slot="active-icon" src="@/static/tabBar/tabBar4.png"></image>
				<image class="tabbarImg" slot="inactive-icon" src="@/static/tabBar/tabBar4.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="我的" name="my/my" @click="changeItem">
				<image class="tabbarImg" slot="active-icon" src="@/static/tabBar/tabBar5.png"></image>
				<image class="tabbarImg" slot="inactive-icon" src="@/static/tabBar/tabBar5.png"></image>
			</u-tabbar-item>
			<image class="tabbarBG" src="@/static/home/tabbarBG.png"></image>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		name: "myTabBar",
		props: {
			nowIndex: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				value: 'index/index',
			};
		},
		mounted() {
			this.value = this.nowIndex
		},
		beforeMount(e) {
			console.log(this.$route);
		},
		methods: {
			changeItem(name) {
				console.log(name);
				this.$navTo(`pages/${name}`)
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .u-tabbar__placeholder {
		background-color: transparent;
	}

	.tabbarImg {
		width: 50rpx;
		height: 50rpx;
		object-fit: cover;
	}

	.tabbarBG {
		height: 100%;
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		z-index: -1;
	}
</style>